﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;

namespace FrameWork.UI.Controls
{
    /// <summary>
    /// 系统按钮（图标）
    /// </summary>
    public class NbSysButton : Button
    {
        static NbSysButton()
        {
            //DefaultStyleKeyProperty.OverrideMetadata(typeof(NbSysButton), new FrameworkPropertyMetadata(typeof(NbSysButton)));
            StyleProperty.OverrideMetadata(typeof(NbSysButton), new FrameworkPropertyMetadata(Application.Current.TryFindResource(nameof(NbSysButton))));
        }

        #region Dp
        public CornerRadius CornerRadius
        {
            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
            set { SetValue(CornerRadiusProperty, value); }
        }
        public static readonly DependencyProperty CornerRadiusProperty =
            DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(NbSysButton), new PropertyMetadata(new CornerRadius()));

        /// <summary>
        /// 按钮图标
        /// </summary>
        public Geometry Icon
        {
            get { return (Geometry)GetValue(IconProperty); }
            set { SetValue(IconProperty, value); }
        }
        public static readonly DependencyProperty IconProperty =
            DependencyProperty.Register("Icon", typeof(Geometry), typeof(NbSysButton), new PropertyMetadata(null));

        public double IconWidth
        {
            get { return (double)GetValue(IconWidthProperty); }
            set { SetValue(IconWidthProperty, value); }
        }
        public static readonly DependencyProperty IconWidthProperty =
            DependencyProperty.Register("IconWidth", typeof(double), typeof(NbSysButton), new PropertyMetadata(12d));

        public double IconHeight
        {
            get { return (double)GetValue(IconHeightProperty); }
            set { SetValue(IconHeightProperty, value); }
        }
        public static readonly DependencyProperty IconHeightProperty =
            DependencyProperty.Register("IconHeight", typeof(double), typeof(NbSysButton), new PropertyMetadata(12d));

        public Brush MouseOverBackground
        {
            get { return (Brush)GetValue(MouseOverBackgroundProperty); }
            set { SetValue(MouseOverBackgroundProperty, value); }
        }
        public static readonly DependencyProperty MouseOverBackgroundProperty =
            DependencyProperty.Register("MouseOverBackground", typeof(Brush), typeof(NbSysButton));

        public Brush PressedBackground
        {
            get { return (Brush)GetValue(PressedBackgroundProperty); }
            set { SetValue(PressedBackgroundProperty, value); }
        }
        public static readonly DependencyProperty PressedBackgroundProperty =
            DependencyProperty.Register("PressedBackground", typeof(Brush), typeof(NbSysButton), new PropertyMetadata());
        #endregion
    }

    /// <summary>
    /// 最大化/向下还原按钮
    /// </summary>
    public class NbMaxSysButton : NbSysButton
    {
        static NbMaxSysButton()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(NbMaxSysButton), new FrameworkPropertyMetadata(typeof(NbMaxSysButton)));
        }
    }

    /// <summary>
    /// 最小化按钮
    /// </summary>
    public class NbMinSysButton : NbSysButton
    {
        static NbMinSysButton()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(NbMinSysButton), new FrameworkPropertyMetadata(typeof(NbMinSysButton)));
        }
    }

    /// <summary>
    /// 关闭按钮
    /// </summary>
    public class NbCloseSysButton : NbSysButton
    {
        static NbCloseSysButton()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(NbCloseSysButton), new FrameworkPropertyMetadata(typeof(NbCloseSysButton)));
        }
    }
}
